﻿--HEADER Add User Role For Admin panel

declare @id as int 

select @id = Id from Membership.[Role] where Title = 'Admin' and EntityId is null
if @id is null
begin 
insert into Membership.[Role] (Title, EntityId, Description) values ('Admin', null, 'Admin')
select @id = @@identity


insert into Membership.User2Role (UserId, RoleId)
select Id, @Id from membership.[User]
where LoginName = 'Admin'
end